<?php
defined( '_JEXEC' ) or die( 'Restricted access' );

function igalleryBuildRoute(&$query)
{
    global $mainframe;
    $segments = array();
    if ($query['view'] == 'igcategory'){
		$query['view'] = $query['view'];
		$segments[] = $query['view'];
		unset($query['view']);
	}
	
	if(isset($query['cid']) && is_array($query['cid']))	{
		$segments[] = $query['cid'][0];
		unset($query['cid']);
	}elseif(isset($query['cid'])){
		$segments[] = $query['cid'];
		unset($query['cid']);
	}
	
	//var_dump($segments);
return $segments;
}

function igalleryParseRoute($segments)
{
    $vars = array();
	$arr = explode(':', $segments[1]);
    $vars['cid'] = $arr[0];
    $vars['view'] = 'igcategory';
    return $vars;
    
}

?>